

$(function(){
	$(".loginsub").click(function(event) {
		var username = $("#username").val();
		var password = $("#password").val();
		$.post('/login_do/', {username: username,password:password}, function(data) {
			 var jobj = JSON.parse(data)
			 if(jobj.code==1){
			 	doalert(jobj.msg);
			 	setTimeout(function(){
			 		document.location.href="/";
			 	},2e3)
			 }else{
			 	doalert(jobj.msg,'错误');
			 }

		});
	});

	$('.logindiv').keydown(function(e){
		if(e.which == 13){
			$(".loginsub").click();
		}
	})
})